package com.miniso.robot.bean;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.*;

/**
 * @author guojunwang
 * @date 2021-10-18 16:15
 */
@Getter
@JsonNaming( PropertyNamingStrategies.SnakeCaseStrategy.class )
public class TextMessage extends Message{

    private final String msgtype = "text";

    private String content;

    private final Map<String,Object> text = new HashMap(8);

    {
        text.put("content","");
        //要@的人，@all 通知所有人
        text.put("mentioned_list",new HashSet<String>());
        //要@的人的手机号，@all 通知所有人
        text.put("mentioned_mobile_list",new HashSet<String>());
    }

    public void setContent(String content){
        this.text.put("content",content);
    }

    public void setMentionedList(Collection<String> mentionedList){
        getMentionedList().addAll(mentionedList);
    }

    public void setMentionedMobileList(Collection<String> mentionedMobileList){
        getMentionedMobileList().addAll(mentionedMobileList);
    }


    public void addMentioned( String mentionedList ){
        getMentionedList().add(mentionedList);
    }

    public void addMentionedMobile( String mentionedMobile ){
        getMentionedMobileList().add(mentionedMobile);
    }


    public Collection<String> getMentionedList(){
        return (Collection<String>)this.text.get("mentioned_list");
    }

    public Collection<String> getMentionedMobileList(){
        return (Collection<String>)this.text.get("mentioned_mobile_list");
    }


}
